<?php /* Smarty version 2.6.18, created on 2009-10-31 14:00:55
         compiled from exporterShipmentSummaryReportSub.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'number_format', 'exporterShipmentSummaryReportSub.tpl', 98, false),)), $this); ?>
<br><br>
<div>
<?php $this->assign('cal_count', ''); ?>
<?php $_from = $this->_tpl_vars['yearmonth']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['month']):
?>
	<?php $this->assign('cal_count', ($this->_tpl_vars['cal_count']+1)); ?>
<?php endforeach; endif; unset($_from); ?>

	<table border="1" style="border-collapse: collapse;" width="100%">
	
	    <tr>
            <td colspan="<?php echo $this->_tpl_vars['cal_count']; ?>
" style="background-color: #ff00ff;"><b>OVERALL</b></td>
        </tr>
        <tr>
			<td style="background-color: #ff00ff;"><b>Month/Year</b></td>
			<?php $_from = $this->_tpl_vars['yearmonth']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['month']):
?>
				<td align="right" style="background-color: #ff00ff;"><b><?php echo $this->_tpl_vars['month']['year_month_name']; ?>
</b></td>
			<?php endforeach; endif; unset($_from); ?>
			<td align="right" style="background-color: #ff00ff;"><b>TOTAL</b></td>
		</tr>
		
		<tr>
			<td >Total Number of Shipments</td>
			<?php $this->assign('total_shipment', ''); ?>
			<?php $_from = $this->_tpl_vars['yearmonth']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['month']):
?>
				<?php $this->assign('ship_quantity', ''); ?>
				<?php $_from = $this->_tpl_vars['shipments']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['shipment']):
?>
					<?php if ($this->_tpl_vars['month']['year_month'] == $this->_tpl_vars['shipment']['yearmonth']): ?>
						<?php $this->assign('total_shipment', ($this->_tpl_vars['shipment']['sum_ship_quantity']+$this->_tpl_vars['total_shipment'])); ?>
						<?php $this->assign('ship_quantity', ($this->_tpl_vars['shipment']['sum_ship_quantity'])); ?>
					<?php endif; ?>
				<?php endforeach; endif; unset($_from); ?>
				<td align="right"><?php echo $this->_tpl_vars['ship_quantity']; ?>
</td>
			<?php endforeach; endif; unset($_from); ?>
			<td  align="right"><?php echo $this->_tpl_vars['total_shipment']; ?>
</td>
		</tr>
		
		<tr>
			<td >Total Number of Species Delivered</td>
			<?php $this->assign('total_species', ''); ?>
			<?php $_from = $this->_tpl_vars['yearmonth']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['month']):
?>
				<?php $this->assign('species_delivered', ''); ?>
				<?php $_from = $this->_tpl_vars['shipments']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['shipment']):
?>
					<?php if ($this->_tpl_vars['month']['year_month'] == $this->_tpl_vars['shipment']['yearmonth']): ?>
						<?php $this->assign('total_species', ($this->_tpl_vars['shipment']['count_species_delivered']+$this->_tpl_vars['total_species'])); ?>
						<?php $this->assign('species_delivered', ($this->_tpl_vars['shipment']['count_species_delivered'])); ?>
					<?php endif; ?>
				<?php endforeach; endif; unset($_from); ?>
				<td align="right"><?php echo $this->_tpl_vars['species_delivered']; ?>
</td>
			<?php endforeach; endif; unset($_from); ?>
			<td  align="right"><?php echo $this->_tpl_vars['total_species']; ?>
</td>
		</tr>
		
		<tr>
			<td >Average DOA %</td>
			<?php $_from = $this->_tpl_vars['yearmonth']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['month']):
?>
				<?php $this->assign('doa_perc', ''); ?>
				<?php $_from = $this->_tpl_vars['doas']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['doa']):
?>
					<?php if ($this->_tpl_vars['month']['year_month'] == $this->_tpl_vars['doa']['yearmonth']): ?>
						<?php $this->assign('total_doa', ($this->_tpl_vars['doa']['doa_percentage']+$this->_tpl_vars['total_doa'])); ?>
						<?php $this->assign('count_doa', ($this->_tpl_vars['count_doa']+1)); ?>
						<?php $this->assign('doa_perc', ($this->_tpl_vars['doa']['doa_percentage'])); ?>
					<?php endif; ?>
				<?php endforeach; endif; unset($_from); ?>
				<td align="right"><?php echo $this->_tpl_vars['doa_perc']; ?>
</td>
			<?php endforeach; endif; unset($_from); ?>
			<?php $this->assign('average_doa', ($this->_tpl_vars['total_doa']/$this->_tpl_vars['count_doa'])); ?>
			<td  align="right"><?php echo $this->_tpl_vars['average_doa']; ?>
</td>
		</tr>
		
		<tr>
			<td >Average Reject %</td>
			<?php $_from = $this->_tpl_vars['yearmonth']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['month']):
?>
				<?php $this->assign('reject_perc', ''); ?>
				<?php $_from = $this->_tpl_vars['rejects']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['reject']):
?>
					<?php if ($this->_tpl_vars['month']['year_month'] == $this->_tpl_vars['reject']['yearmonth']): ?>
						<?php $this->assign('total_reject', ($this->_tpl_vars['reject']['reject_percentage']+$this->_tpl_vars['total_reject'])); ?>
						<?php $this->assign('count_reject', ($this->_tpl_vars['count_reject']+1)); ?>
						<?php $this->assign('reject_perc', ($this->_tpl_vars['reject']['reject_percentage'])); ?>
					<?php endif; ?>
				<?php endforeach; endif; unset($_from); ?>
				<td  align="right"><?php echo $this->_tpl_vars['reject_perc']; ?>
</td>
			<?php endforeach; endif; unset($_from); ?>
			<?php $this->assign('average_reject', ($this->_tpl_vars['total_reject']/$this->_tpl_vars['count_reject'])); ?>
			<td  align="right"><?php echo $this->_tpl_vars['average_reject']; ?>
</td>
		</tr>
		
		<tr>
			<td >Revenue (PKG)</td>
			<?php $this->assign('total_revenue', ''); ?>
			<?php $_from = $this->_tpl_vars['yearmonth']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['month']):
?>
				<?php $this->assign('ship_amount', 0); ?>
				<?php $_from = $this->_tpl_vars['shipments']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['shipment']):
?>
					<?php if ($this->_tpl_vars['month']['year_month'] == $this->_tpl_vars['shipment']['yearmonth']): ?>
						<?php $this->assign('total_revenue', ($this->_tpl_vars['shipment']['sum_ship_amount']+$this->_tpl_vars['total_revenue'])); ?>
						<?php $this->assign('ship_amount', ($this->_tpl_vars['shipment']['sum_ship_amount'])); ?>
					<?php endif; ?>
				<?php endforeach; endif; unset($_from); ?>
				<td  align="right"><?php echo $this->_tpl_vars['shipment']['currency_mark']; ?>
&nbsp;<?php echo ((is_array($_tmp=$this->_tpl_vars['ship_amount'])) ? $this->_run_mod_handler('number_format', true, $_tmp, '2%d') : number_format($_tmp, '2%d')); ?>
</td>
			<?php endforeach; endif; unset($_from); ?>
			<td  align="right"><?php echo $this->_tpl_vars['shipment']['currency_mark']; ?>
&nbsp;<?php echo ((is_array($_tmp=$this->_tpl_vars['total_revenue'])) ? $this->_run_mod_handler('number_format', true, $_tmp, '2%d') : number_format($_tmp, '2%d')); ?>
</td>
		</tr>
		
	</table>
	
	<?php if ($this->_tpl_vars['show_shipment_summary'] == 1): ?>
		<br><br>
		<table border="1" style="border-collapse: collapse;" width="100%">
			<tr>
				<td colspan="26" style="background-color: #ff00ff;"><b>NUMBER of SHIPMENTS</b></td>
			</tr>
			<tr>
				<td style="background-color: #ff00ff;"><b>Month/Year</b></td>
				<?php $_from = $this->_tpl_vars['yearmonth']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['month']):
?>
					<td align="right" style="background-color: #ff00ff;"><b><?php echo $this->_tpl_vars['month']['year_month_name']; ?>
</b></td>
				<?php endforeach; endif; unset($_from); ?>
				<td align="right" style="background-color: #ff00ff;"><b>TOTAL</b></td>
			</tr>
			
			<?php $_from = $this->_tpl_vars['orgs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['org']):
?>
				<tr>
					<td><?php echo $this->_tpl_vars['org']['name']; ?>
</td>
				<?php $this->assign('total_summary_shipment', ''); ?>
				<?php $_from = $this->_tpl_vars['yearmonth']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['month']):
?>
					<?php $this->assign('summary_shipments', ''); ?>
					<?php $_from = $this->_tpl_vars['details']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['detail']):
?>
						<?php if ($this->_tpl_vars['month']['year_month'] == $this->_tpl_vars['detail']['yearmonth'] && $this->_tpl_vars['org']['org_id'] == $this->_tpl_vars['detail']['org_id']): ?>
							<?php $this->assign('total_summary_shipment', ($this->_tpl_vars['detail']['count_shipments']+$this->_tpl_vars['total_summary_shipment'])); ?>
							<?php $this->assign('summary_shipments', ($this->_tpl_vars['detail']['count_shipments'])); ?>
						<?php endif; ?>
					<?php endforeach; endif; unset($_from); ?>
					<td align="right"><?php echo $this->_tpl_vars['summary_shipments']; ?>
</td>
				<?php endforeach; endif; unset($_from); ?>
					<td align="right"><?php echo $this->_tpl_vars['total_summary_shipment']; ?>
</td>
				</tr>
			<?php endforeach; endif; unset($_from); ?>
			
			<tr>
				<td><b>Total</b></td>
				<?php $this->assign('total_total_shipment', ''); ?>
				<?php $_from = $this->_tpl_vars['yearmonth']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['month']):
?>
					<?php $this->assign('month_total_shipment', ''); ?>
					<?php $_from = $this->_tpl_vars['totals']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['total']):
?>
						<?php if ($this->_tpl_vars['month']['year_month'] == $this->_tpl_vars['total']['yearmonth']): ?>
							<?php $this->assign('month_total_shipment', ($this->_tpl_vars['total']['count_shipments'])); ?>		
							<?php $this->assign('total_total_shipment', ($this->_tpl_vars['total']['count_shipments']+$this->_tpl_vars['total_total_shipment'])); ?>
						<?php endif; ?>
					<?php endforeach; endif; unset($_from); ?>
					<td align="right"><b><?php echo $this->_tpl_vars['month_total_shipment']; ?>
</b></td>
				<?php endforeach; endif; unset($_from); ?>
				<td align="right"><b><?php echo $this->_tpl_vars['total_total_shipment']; ?>
</b></td>
			</tr>
		</table>
	<?php endif; ?>
	

	<?php if ($this->_tpl_vars['show_organism_shipment'] == 1): ?>
		<br><br>
		<table border="1" style="border-collapse: collapse;" width="100%">
			<tr>
				<td colspan="26" style="background-color: #ff00ff;"><b>NUMBER of ORGANISMS per SHIPMENTS</b></td>
			</tr>
			<tr>
				<td style="background-color: #ff00ff;"><b>Month/Year</b></td>
				<?php $_from = $this->_tpl_vars['yearmonth']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['month']):
?>
					<td align="right" style="background-color: #ff00ff;"><b><?php echo $this->_tpl_vars['month']['year_month_name']; ?>
</b></td>
				<?php endforeach; endif; unset($_from); ?>
				<td align="right" style="background-color: #ff00ff;"><b>TOTAL</b></td>
			</tr>
			
			<?php $_from = $this->_tpl_vars['orgs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['org']):
?>
				<tr>
					<td><?php echo $this->_tpl_vars['org']['name']; ?>
</td>
				<?php $this->assign('total_summary_quantity', ''); ?>
				<?php $_from = $this->_tpl_vars['yearmonth']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['month']):
?>
					<?php $this->assign('summary_quantity', ''); ?>
					<?php $_from = $this->_tpl_vars['details']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['detail']):
?>
						<?php if ($this->_tpl_vars['month']['year_month'] == $this->_tpl_vars['detail']['yearmonth'] && $this->_tpl_vars['org']['org_id'] == $this->_tpl_vars['detail']['org_id']): ?>
							<?php $this->assign('total_summary_quantity', ($this->_tpl_vars['detail']['sum_ship_quantity']+$this->_tpl_vars['total_summary_quantity'])); ?>
							<?php $this->assign('summary_quantity', ($this->_tpl_vars['detail']['sum_ship_quantity'])); ?>
						<?php endif; ?>
					<?php endforeach; endif; unset($_from); ?>
					<td align="right"><?php echo $this->_tpl_vars['summary_quantity']; ?>
</td>
				<?php endforeach; endif; unset($_from); ?>
					<td align="right"><?php echo $this->_tpl_vars['total_summary_quantity']; ?>
</td>
				</tr>
			<?php endforeach; endif; unset($_from); ?>
			
			<tr>
				<td><b>Total</b></td>
				<?php $this->assign('total_total', ''); ?>
				<?php $_from = $this->_tpl_vars['yearmonth']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['month']):
?>
					<?php $this->assign('month_total', ''); ?>
					<?php $_from = $this->_tpl_vars['totals']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['total']):
?>
						<?php if ($this->_tpl_vars['month']['year_month'] == $this->_tpl_vars['total']['yearmonth']): ?>
							<?php $this->assign('month_total', ($this->_tpl_vars['total']['sum_ship_quantity'])); ?>		
							<?php $this->assign('total_total', ($this->_tpl_vars['total']['sum_ship_quantity']+$this->_tpl_vars['total_total'])); ?>
						<?php endif; ?>
					<?php endforeach; endif; unset($_from); ?>
					<td align="right"><b><?php echo $this->_tpl_vars['month_total']; ?>
</b></td>
				<?php endforeach; endif; unset($_from); ?>
				<td align="right"><b><?php echo $this->_tpl_vars['total_total']; ?>
</b></td>
			</tr>
		</table>
	<?php endif; ?>
	
</div>
<br>
<div id="print">
	<table>
		<tr>
			<td><input type="button" value="Save to Excel"/></td>
			<td><input type="button" value="Print"/></td>
		</tr>
	</table>
</div>